from appium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
from base import Base

class Sousuopage(Base):

    gaunzhu = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.ImageView')
    sousuokuang = (By.XPATH,'android.widget.LinearLayout[@resource-id="com.kongfz.app:id/ll_search"]')
    shurukaung = (By.XPATH,'android.widget.EditText[@text="动态 书友 话题"]')
    sousuoanniu = (By.ID,'com.kongfz.app:id/tv_search')
    dy = (By.XPATH,'android.widget.TextView[@text="动态"]')


    huati = (By.ID,'com.kongfz.app:id/tv_topic')
    dy1 = (By.XPATH,'android.widget.TextView[@text="推荐"]')

    xinxi  = (By.ID,'com.kongfz.app:id/iv_dot_icon')
    dy2 = (By.XPATH,'android.widget.TextView[@text="消息"]')

    def sousuoyw(self,a):
        self.find_ele(self.gaunzhu).click()
        sleep(2)
        self.find_ele(self.sousuokuang).click()
        sleep(2)
        self.find_ele(self.shurukaung).get_attribute(a)
        sleep(2)
        self.find_ele(self.sousuoanniu).click()
        sleep(2)

    def huatiyw(self):
        self.find_ele(self.gaunzhu).click()
        sleep(2)
        self.find_ele(self.huati).click()
        sleep(2)

    def xinxiyw(self):
        self.find_ele(self.gaunzhu).click()
        sleep(2)
        self.find_ele(self.xinxi).click()
        sleep(2)


